package com.xz.controller;

import com.xz.bean.BTInfo;
import com.xz.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xingzhe
 * Date: 2015/1/7
 * Time: 15:20
 */
@Controller
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public class BTSearchController {
    @Autowired
    SearchService searchService;

    @GET
    @Path("list")
    public List<BTInfo> getBtList(@QueryParam("offset") int offset, @QueryParam("length") int length, @QueryParam("word") String word) {
        if (length == 0)
            length = 20;
        return searchService.listBt(word, offset, length);
    }


}
